package com.bstek.bdf2.core.orm.transaction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.TransactionManagementConfigurer;

/**
 * @Title: TransactionConfig
 * @Package: com.bstek.bdf2.core.orm.transaction
 * @Description:
 * @Author: zxq
 * @Date: 2024/1/2 - 18:53
 */

@Configuration
@EnableTransactionManagement
public class TransactionConfig implements TransactionManagementConfigurer {

    @Autowired
    private JdbcTransactionManager jdbcTransactionManager;

    @Bean
    public PlatformTransactionManager transactionManager() {
        return jdbcTransactionManager;
    }

    @Override
    public TransactionManager annotationDrivenTransactionManager() {
        return transactionManager();
    }
}
